import React from 'react';
import {TouchableWithoutFeedback, Text} from 'react-native';
import {createStaticNavigation} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import Home from './Home';
import Detail from './Detail';
import My from './My';

export default function Test() {
  const RootStack = createNativeStackNavigator({
    initialRouteName: 'Home',
    screenOptions: {
      headerTitleAlign: 'center',
      headerTintColor: '#fff',
      headerStyle: {backgroundColor: 'tomato'},
      headerTitleStyle: {color: '#fff'},
    },
    screens: {
      Home: {
        screen: Home,
        options: {
          title: '首页',
          headerRight: () => (
            <TouchableWithoutFeedback onPress={() => console.log('2131231')}>
              <Text>按钮</Text>
            </TouchableWithoutFeedback>
          ),
        },
      },
      Detail: {
        screen: Detail,
        options: {
          title: '详情',
        },
      },
      My: {
        screen: My,
        options: {
          title: '我的',
        },
        initialParams: {
          name: '我的',
        },
      },
    },
  });

  const Navigation = createStaticNavigation(RootStack);

  return <Navigation />;
}
